package com;

import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class Regist implements ImportBeanDefinitionRegistrar {
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
        GenericBeanDefinition bd = new GenericBeanDefinition();
        bd.setBeanClassName(H.class.getName());
        //指定构造方法
        ConstructorArgumentValues v = new ConstructorArgumentValues();
        v.addIndexedArgumentValue(0,21);
        bd.setConstructorArgumentValues(v);
        registry.registerBeanDefinition("hhhhhhhhhhhhhhhhhhhh",bd);
        this.registerBeanDefinitions(importingClassMetadata, registry);
    }
}
